package com.aosiding.demo.service.impl;

import com.aosiding.demo.domain.User;
import com.aosiding.demo.mapper.CRUDMapper;
import com.aosiding.demo.service.CRUDService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CRUDServiceImpl implements CRUDService {
    @Autowired
    private CRUDMapper crudMapper;

    @Override
    public List<User> getAllUser() {
        List<User> userList = crudMapper.getAllUser();
        return userList;
    }

    @Override
    public User getUserById(Long id) {
        User user = crudMapper.getUserById(id);
        return user;
    }

    @Override
    public boolean createUser(User user) {
        boolean flag = crudMapper.createUser(user);
        return flag;
    }

    @Override
    public boolean deleteById(Long id) {
        boolean flag = crudMapper.deleteById(id);
        return flag;
    }

    @Override
    public boolean updateById(User user) {
        boolean flag = crudMapper.updateById(user);
        return flag;
    }
}
